<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
    'use strict';
/*
    var zjzAPP = {
      name: "zjz",
      birth: 1999,
      // 方法
      age: function (){
        //今年-出生的年
        var nowDate = new Date().getFullYear();
        return nowDate-this.birth;
      }
    };
*/



     function getAge(){
      //今年-出生的年
      var nowDate = new Date().getFullYear();
      return nowDate-this.birth;
    }

    var zjzAPP = {
      name: "zjz",
      birth: 1999,
      // 方法
      age:getAge
    };
    getAge.apply(zjzAPP,[]);// this指向了zjzAPP，参数为空
    console.log(zjzAPP.age());// 方法一定要带()

  </script>
</head>
<body>

</body>
</html>